package com.briup.cms.dao;

import com.briup.cms.bean.Comment;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface CommentMapper {
    @Results({
            @Result(column = "comment_date", property = "commentDate"),
            @Result(column = "article_id", property = "articleId"),
            @Result(column = "user_id", property = "userId"),
            @Result(column = "parent_id", property = "parentId")

    })
    @Select("select * from cms_comment")
    List<Comment>selectAll();
    @Insert("insert into cms_comment values(null,#{content},#{commentDate},#{status},#{articleId},#{userId},#{parentId})")
    void insert(Comment comment);
    @Update("update cms_comment set content=#{content},comment_date=#{commentDate},status=#{status},article_id=#{articleId},user_id=#{userId},parent_id=#{parentId} where id=#{id}")
    void update(Comment comment);
    @Delete("delete from cms_comment where id=#{id}")
    void deleteById(long id);


}
